package org.lanqiao.tjut.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class MyInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		// 调用目标action之前
		long beginT = System.currentTimeMillis();
		// 调用目标action，获取action的执行结果
		String strR = invocation.invoke();
		// 调用目标action之后
		long endT = System.currentTimeMillis();
		System.out.println(invocation.getAction().getClass().getName() + "执行时间(ms)：" + (endT - beginT));
		// 返回目标action的结果串，否则后续处理无法进行
		return strR;
	}

}
